.class public Lroboguice/event/ObservesTypeListener;
.super Ljava/lang/Object;
.source "ObservesTypeListener.java"

# interfaces
.implements Lcom/google/inject/spi/TypeListener;


# instance fields
.field protected a:Lroboguice/event/EventManager;

.field protected b:Lcom/google/inject/Provider;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lcom/google/inject/Provider",
            "<",
            "Landroid/content/Context;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>(Lcom/google/inject/Provider;Lroboguice/event/EventManager;)V
    .locals 0
    .parameter
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lcom/google/inject/Provider",
            "<",
            "Landroid/content/Context;",
            ">;",
            "Lroboguice/event/EventManager;",
            ")V"
        }
    .end annotation

    .prologue
    .line 24
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 25
    iput-object p2, p0, Lroboguice/event/ObservesTypeListener;->a:Lroboguice/event/EventManager;

    .line 26
    iput-object p1, p0, Lroboguice/event/ObservesTypeListener;->b:Lcom/google/inject/Provider;

    .line 27
    return-void
.end method


# virtual methods
.method protected a(Lcom/google/inject/spi/TypeEncounter;Ljava/lang/reflect/Method;Ljava/lang/Class;)V
    .locals 3
    .parameter
    .parameter
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<I:",
            "Ljava/lang/Object;",
            ">(",
            "Lcom/google/inject/spi/TypeEncounter",
            "<TI;>;",
            "Ljava/lang/reflect/Method;",
            "Ljava/lang/Class;",
            ")V"
        }
    .end annotation

    .prologue
    .line 63
    invoke-virtual {p0, p2}, Lroboguice/event/ObservesTypeListener;->a(Ljava/lang/reflect/Method;)V

    .line 64
    new-instance v0, Lroboguice/event/ObservesTypeListener$ContextObserverMethodInjector;

    iget-object v1, p0, Lroboguice/event/ObservesTypeListener;->b:Lcom/google/inject/Provider;

    iget-object v2, p0, Lroboguice/event/ObservesTypeListener;->a:Lroboguice/event/EventManager;

    invoke-direct {v0, v1, v2, p2, p3}, Lroboguice/event/ObservesTypeListener$ContextObserverMethodInjector;-><init>(Lcom/google/inject/Provider;Lroboguice/event/EventManager;Ljava/lang/reflect/Method;Ljava/lang/Class;)V

    invoke-interface {p1, v0}, Lcom/google/inject/spi/TypeEncounter;->register(Lcom/google/inject/spi/InjectionListener;)V

    .line 65
    return-void
.end method

.method protected a(Ljava/lang/reflect/Method;)V
    .locals 2
    .parameter

    .prologue
    .line 73
    invoke-virtual {p1}, Ljava/lang/reflect/Method;->getParameterTypes()[Ljava/lang/Class;

    move-result-object v0

    array-length v0, v0

    const/4 v1, 0x1

    if-le v0, v1, :cond_0

    .line 74
    new-instance v0, Ljava/lang/RuntimeException;

    const-string v1, "Annotation @Observes must only annotate one parameter, which must be the only parameter in the listener method."

    invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v0

    .line 76
    :cond_0
    return-void
.end method

.method protected a(Ljava/lang/reflect/Method;Lcom/google/inject/spi/TypeEncounter;)V
    .locals 9
    .parameter
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<I:",
            "Ljava/lang/Object;",
            ">(",
            "Ljava/lang/reflect/Method;",
            "Lcom/google/inject/spi/TypeEncounter",
            "<TI;>;)V"
        }
    .end annotation

    .prologue
    const/4 v8, 0x0

    .line 42
    invoke-virtual {p1}, Ljava/lang/reflect/Method;->getParameterAnnotations()[[Ljava/lang/annotation/Annotation;

    move-result-object v0

    move v1, v8

    .line 43
    :goto_0
    array-length v2, v0

    if-ge v1, v2, :cond_2

    .line 44
    aget-object v2, v0, v1

    .line 45
    invoke-virtual {p1}, Ljava/lang/reflect/Method;->getParameterTypes()[Ljava/lang/Class;

    move-result-object v3

    .line 46
    aget-object v3, v3, v1

    .line 48
    array-length v4, v2

    move v5, v8

    :goto_1
    if-ge v5, v4, :cond_1

    aget-object v6, v2, v5

    .line 49
    invoke-interface {v6}, Ljava/lang/annotation/Annotation;->annotationType()Ljava/lang/Class;

    move-result-object v6

    const-class v7, Lroboguice/event/Observes;

    invoke-virtual {v6, v7}, Ljava/lang/Object;->equals(Ljava/lang/Object;)Z

    move-result v6

    if-eqz v6, :cond_0

    .line 50
    invoke-virtual {p0, p2, p1, v3}, Lroboguice/event/ObservesTypeListener;->a(Lcom/google/inject/spi/TypeEncounter;Ljava/lang/reflect/Method;Ljava/lang/Class;)V

    .line 48
    :cond_0
    add-int/lit8 v5, v5, 0x1

    goto :goto_1

    .line 43
    :cond_1
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 52
    :cond_2
    return-void
.end method

.method public hear(Lcom/google/inject/TypeLiteral;Lcom/google/inject/spi/TypeEncounter;)V
    .locals 9
    .parameter
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "<I:",
            "Ljava/lang/Object;",
            ">(",
            "Lcom/google/inject/TypeLiteral",
            "<TI;>;",
            "Lcom/google/inject/spi/TypeEncounter",
            "<TI;>;)V"
        }
    .end annotation

    .prologue
    const/4 v8, 0x0

    .line 30
    invoke-virtual {p1}, Lcom/google/inject/TypeLiteral;->getRawType()Ljava/lang/Class;

    move-result-object v0

    :goto_0
    const-class v1, Ljava/lang/Object;

    if-eq v0, v1, :cond_3

    .line 31
    invoke-virtual {v0}, Ljava/lang/Class;->getDeclaredMethods()[Ljava/lang/reflect/Method;

    move-result-object v1

    array-length v2, v1

    move v3, v8

    :goto_1
    if-ge v3, v2, :cond_0

    aget-object v4, v1, v3

    .line 32
    invoke-virtual {p0, v4, p2}, Lroboguice/event/ObservesTypeListener;->a(Ljava/lang/reflect/Method;Lcom/google/inject/spi/TypeEncounter;)V

    .line 31
    add-int/lit8 v3, v3, 0x1

    goto :goto_1

    .line 34
    :cond_0
    invoke-virtual {v0}, Ljava/lang/Class;->getInterfaces()[Ljava/lang/Class;

    move-result-object v1

    array-length v2, v1

    move v3, v8

    :goto_2
    if-ge v3, v2, :cond_2

    aget-object v4, v1, v3

    .line 35
    invoke-virtual {v4}, Ljava/lang/Class;->getDeclaredMethods()[Ljava/lang/reflect/Method;

    move-result-object v4

    array-length v5, v4

    move v6, v8

    :goto_3
    if-ge v6, v5, :cond_1

    aget-object v7, v4, v6

    .line 36
    invoke-virtual {p0, v7, p2}, Lroboguice/event/ObservesTypeListener;->a(Ljava/lang/reflect/Method;Lcom/google/inject/spi/TypeEncounter;)V

    .line 35
    add-int/lit8 v6, v6, 0x1

    goto :goto_3

    .line 34
    :cond_1
    add-int/lit8 v3, v3, 0x1

    goto :goto_2

    .line 30
    :cond_2
    invoke-virtual {v0}, Ljava/lang/Class;->getSuperclass()Ljava/lang/Class;

    move-result-object v0

    goto :goto_0

    .line 39
    :cond_3
    return-void
.end method
